package com.pansoft.kline.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.efounder.utils.JfResourceUtil;
import com.pansoft.kline.model.TableInfo;
import com.pansoft.openplanet.R;
import com.utilcode.util.TimeUtils;

import java.text.SimpleDateFormat;
import java.util.List;

/**
 * @author : zzj
 * @e-mail : zhangzhijun@pansoft.com
 * @date : 2018/11/12 14:07
 * @desc :
 * @version: 1.0
 */
public class DealBigMonitoringAdapter  extends BaseQuickAdapter<TableInfo,BaseViewHolder> {

    public DealBigMonitoringAdapter(int layoutResId, @Nullable List<TableInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TableInfo item) {
        if(helper.getAdapterPosition() == 0){
            helper.setText(R.id.tv_time, item.getTime());
            helper.setTextColor(R.id.tv_time,JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_buy, JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_sale,JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_flow_into,JfResourceUtil.getSkinColor(R.color.black_text_color));
        }else {
            helper.setText(R.id.tv_time, TimeUtils.date2String(TimeUtils.string2Date(item.getTime()
                    ,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")),new SimpleDateFormat("HH:mm:ss")));
            helper.setTextColor(R.id.tv_time,JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_buy,JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_sale,JfResourceUtil.getSkinColor(R.color.black_text_color));
            helper.setTextColor(R.id.tv_flow_into,JfResourceUtil.getSkinColor(R.color.black_text_color));
        }
        helper.setText(R.id.tv_buy,item.getBuy());
        helper.setText(R.id.tv_sale,item.getSale());
        helper.setText(R.id.tv_flow_into,item.getFlowInto());

    }
}
